package wnhz.com.business.groupshop.ui;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle;
import android.view.WindowManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import butterknife.BindView;
import butterknife.ButterKnife;
import wnhz.com.business.R;
import wnhz.com.business.base.BaseActivity;
import wnhz.com.business.impl.ActionBarClickListener;
import wnhz.com.business.view.TranslucentActionBar;

public class AboutOurActivity extends BaseActivity implements ActionBarClickListener {

    @BindView(R.id.actionbar)
    TranslucentActionBar actionbar;
    private WebView web_webView;

    public static Intent createIntent(Context context) {
        Intent intent = new Intent(context, AboutOurActivity.class);
        return intent;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about_our);
        ButterKnife.bind(this);
        actionbar.setData("关于拼团商城", R.drawable.ic_lefft_white, null, 0, "", 0,this);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            actionbar.setStatusBarHeight(getStatusBarHeight());
        }

        web_webView = (WebView) findViewById(R.id.web_webView);

        WebSettings webSettings = web_webView.getSettings();
        //设置WebView属性，能够执行Javascript脚本
        webSettings.setJavaScriptEnabled(true);
        //设置可以访问文件
        webSettings.setAllowFileAccess(true);
        //关闭webview的放大缩小按钮
        webSettings.setDisplayZoomControls(false);
        //设置支持缩放
        webSettings.setBuiltInZoomControls(true);


        // 加载链接
        web_webView.loadUrl("http://www.baidu.com");
        //设置Web视图
        web_webView.setWebViewClient(new WebClient());

    }

    public class WebClient extends WebViewClient {

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);

        }

        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);

        }
    }

    @Override
    public void onLeftClick() {
        finish();
    }

    @Override
    public void onRightClick() {

    }

    @Override
    public void onEditTextClick() {

    }
}
